<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.js"></script>
</head>
<body>
  <div class="app" id="app">先显示，ready后消失</div>
  <button id="btn">btn</button>
  <script>
    // 1.等着页面DOM加载完毕后再执行代码
    $(document).ready(function(){
      debugger
      $('div').hide
    })
    $(document).ready(function(){
      debugger
      $('div').show()
    })
    // 2.等着页面DOM加载完毕再执行js代码（简单语法）
    $(function(){
      $('div').hide()
    })
    $(function(){
      $("div").show()
    })
    // 获取id值
    $("button").click(function(){
      var id = $(this).attr("id")
      console.log(id)
    })

  </script>
</body>
</html>